class fanzhuan:
    def __init__(self,a):
        self.a=a;
    def solution(self):
        num=[];
        for i in self.a:
            num.append(i);
        if(len(num)==1):
            print(self.a);
        elif(len(num)>=64):
            print(0);
        else:
            if (num[0] == "-"):
                for i in range(1, int((len(num) - 1) / 2)+1):
                    h = num[i];
                    num[i] = num[-i];
                    num[-i] = h;
                if(-(2**31)<=int("".join(num))<=2**31-1):
                    print(int("".join(num)))
                else:
                    print(0);
            elif (num[0] != "-"):
                for i in range(0, int(len(num) / 2 - 1)+1):
                    h = num[i];
                    num[i] = num[-(i + 1)];
                    num[-(i + 1)] = h;
                if (-(2 ** 31) <= int("".join(num)) <= 2 ** 31 - 1):
                    print(int("".join(num)))
                else:
                    print(0);


if __name__ == '__main__':
    a=input("请输入一串有符号整数串");
    b=fanzhuan(a);
    b.solution();
#1234,12345,123